home *** CD-ROM | disk | FTP | other *** search
/ Animation How-To / Animation How-to CD.iso / PLY / CHAPTER5 / VOLCANO / VOLCANO2.BAS < prev    next >
BASIC Source File  |  1994-01-01  |  3KB  |  73 lines

  1. OPEN "volcano2.pi" FOR OUTPUT AS #1
  2.  
  3. print #1, "start_frame 0"
  4. print #1, "end_frame 200"
  5. print #1, "total_frames 200"
  6. print #1, 
  7. print #1, "outfile volc2"
  8. print #1, 
  9. print #1, "include ";chr$(34);"\ply\colors.inc";chr$(34)
  10. print #1, 
  11. print #1, "viewpoint {"
  12. print #1, "   from <25,-2,15>"
  13. print #1, "   at <0,-2,0>"
  14. print #1, "   up <0,1,0>"
  15. print #1, "   angle 35"
  16. print #1, "   resolution 320,200"
  17. print #1, "   aspect 1.43"
  18. print #1, "   }"
  19. print #1, "background SkyBlue"
  20. print #1, 
  21. print #1, "light 0.6*white, < 10,50, 15>"
  22. print #1, "light 0.6*white, < 0,50, 0>"
  23. print #1, 
  24. print #1, "object { cone <0,0,0>,0,<0,-20,0>,20 reflective_white}"
  25. print #1, 
  26. PRINT #1, "define rise 1"
  27. PRINT #1, "define run 1"
  28. PRINT #1, "define br 1  // ball radius"
  29. PRINT #1, "define mindamprate 10"
  30. PRINT #1, "define g 1"
  31. PRINT #1, "define pi 3.14159"
  32. PRINT #1, "define rad pi / 180"
  33. PRINT #1,
  34. PRINT #1, "   // Set the initial conditions"
  35.  
  36. FOR item = 0 TO 99
  37.   count$ = RIGHT$("00" + LTRIM$(STR$(item)), 2)
  38.  
  39. PRINT #1, "if (frame == start_frame) {"
  40. PRINT #1, USING "   static define x\\ 0"; count$
  41. PRINT #1, USING "   static define y\\ 0"; count$
  42. PRINT #1, USING "   static define z\\ 0"; count$
  43. PRINT #1, USING "   define r\\ [5*brownian(<0.1,0.1,0.1>)]"; count$
  44. PRINT #1, USING "   define radius r\\[0][0]"; count$
  45. PRINT #1, USING "   define theta  360 * r\\[0][1] * rad"; count$
  46. PRINT #1, USING "   define phi    (30 + 30 * r\\[0][2]) * rad"; count$
  47. PRINT #1, USING "   define velo r\\[0][0]"; count$
  48. PRINT #1, USING "   static define dr\\ 20 + 20 * r\\[0][1]"; count$; count$
  49. PRINT #1, USING "   static define vx\\ radius * sin(phi) * cos(theta)"; count$
  50. PRINT #1, USING "   static define vy\\ radius * cos(phi) + velo"; count$
  51. PRINT #1, USING "   static define vz\\ radius * sin(phi) * sin(theta)"; count$
  52. PRINT #1, "}"
  53. PRINT #1, "else {"
  54. PRINT #1, USING "   static define x\\ x\\ + vx\\"; count$, count$, count$
  55. PRINT #1, USING "   static define y\\ y\\ + vy\\"; count$, count$, count$
  56. PRINT #1, USING "   static define z\\ z\\ + vz\\"; count$, count$, count$
  57. PRINT #1, "}"
  58. PRINT #1,
  59. PRINT #1, USING "static define vy\\ vy\\ - g"; count$, count$
  60. PRINT #1, USING "define dist (x\\^2 +z\\^2)^0.5"; count$, count$
  61. PRINT #1, "define ring dist/run"
  62. PRINT #1, USING "if (y\\ + ring*rise-br < 0)"; count$
  63. PRINT #1, USING "   { static define vy\\ fabs(vy\\)*(1 - ring / dr\\)"; count$, count$, count$
  64. PRINT #1, USING "     static define vx\\ vx\\*(1 - ring / dr\\)"; count$, count$, count$
  65. PRINT #1, USING "     static define vz\\ vz\\*(1 - ring / dr\\)"; count$, count$, count$
  66. PRINT #1, "}"
  67. PRINT #1, USING "object { sphere <x\\,y\\,z\\>,0.5 shiny__coral }"; count$, count$, count$
  68. PRINT #1,
  69. NEXT item
  70.  
  71. CLOSE #1
  72.  
  73.